<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">全流程对账后台</ui:define>
    <ui:define name="content">

        <h:form>

            <p:defaultCommand target="search"/>
            <div class="topbar clearfix" style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"/>

                        <p:columnToggler datasource="loanwholeprocesschecked" trigger="toggler"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         rendered="#{loanWholeProcessCheckedStatListBean.isNormal()}"
                                         update="@form"/>
                        <p:commandButton value="导出" icon="fa fa-download"
                                         ajax="false">
                            <p:dataExporter type="xls" target="loanwholeprocesschecked" fileName="export"/>
                        </p:commandButton>
                        <p:commandButton value="重置" icon="fa fa-refresh"
                                         rendered="#{loanWholeProcessCheckedStatListBean.isNormal()}"
                                         actionListener="#{loanWholeProcessCheckedStatListBean.onReset}"
                                         process="@this" update="@form"/>
                        <p:commandButton value="刷新缓存" icon="fa fa-refresh"
                                         rendered="#{loanWholeProcessCheckedStatListBean.isNormal()}"
                                         actionListener="#{loanWholeProcessCheckedStatListBean.postRresh()}"
                                         process="@this" update="@form"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="ui-g-12 card">
                            <h1>查询条件</h1>
                            <div class="ui-g-1">
                                <p:outputLabel for="startdate" value="开始日期"/>
                            </div>
                            <div class="ui-g-2">
                                <p:calendar
                                        id="startdate" styleClass="autoWidthCalendar"
                                        value="#{loanWholeProcessCheckedStatListBean.$.startDate}"
                                        locale="#{constants:get('LOCALE')}"
                                        timeZone="#{constants:get('TIME_ZONE')}"
                                        pattern="#{constants:get('DATE_FORMAT')}"/>
                            </div>
                            <div class="ui-g-1">
                                <p:outputLabel for="enddate" value="结束日期"/>
                            </div>
                            <div class="ui-g-2">
                                <p:calendar
                                        id="enddate" styleClass="autoWidthCalendar"
                                        value="#{loanWholeProcessCheckedStatListBean.$.endDate}"
                                        locale="#{constants:get('LOCALE')}"
                                        timeZone="#{constants:get('TIME_ZONE')}"
                                        pattern="#{constants:get('DATE_FORMAT')}"/>
                            </div>
                            <div class="ui-g-1">
                                <p:outputLabel value="渠道"/>
                            </div>
                            <div class="ui-g-2">
                                <p:selectCheckboxMenu id="channel" value="#{loanWholeProcessCheckedStatListBean.$.channel}"
                                                      filter="true" filterMatchMode="contains"  multiple="true">
                                    <f:selectItem itemValue="" itemLabel="-请选择-"></f:selectItem>
                                    <f:selectItems value="#{loanWholeProcessCheckedStatListBean.getCommProductChannels()}" var="info"
                                        itemValue="${info.channelCode}" itemLabel="${info.channelName}"/>
                                </p:selectCheckboxMenu>
                            </div>

                            <div class="ui-g-1">
                                <p:outputLabel value="产品"/>
                            </div>
                            <div class="ui-g-2">
                                <p:selectCheckboxMenu id="prd_name" value="#{loanWholeProcessCheckedStatListBean.$.productid}"
                                                      filter="true" filterMatchMode="contains"  multiple="true"
                                >
                                    <f:selectItem itemValue="" itemLabel="-请选择-"></f:selectItem>
                                    <f:selectItem itemValue="-2000" itemLabel="-全部-"></f:selectItem>
                                    <f:selectItems value="#{loanWholeProcessCheckedStatListBean.getCommProductIds()}" var="proinfo"
                                                   itemLabel="${proinfo.name}" itemValue="${proinfo.productId}"/>
                                </p:selectCheckboxMenu>
                            </div>

                            <div class="ui-g-1">
                                <p:outputLabel value="活动名称"/>
                            </div>
                            <div class="ui-g-2">
                                <p:selectCheckboxMenu id="activeName" value="#{loanWholeProcessCheckedStatListBean.$.activityname}"
                                                      filter="true" filterMatchMode="contains"  multiple="true">
                                    <f:selectItem itemValue="" itemLabel="-请选择-"></f:selectItem>
                                    <f:selectItem itemValue="-2000" itemLabel="-全部-"></f:selectItem>
                                    <f:selectItems value="#{loanWholeProcessCheckedStatListBean.queryApi()}" var="actinfo" multiple="true"
                                                   itemLabel="${actinfo.getName(actinfo.getId())}" itemValue="${actinfo.getId()}"/>
                                </p:selectCheckboxMenu>
                            </div>
                        </div>
                        <div class="card">
                            <p:dataTable id="loanwholeprocesschecked"
                                         style="width: 100%;text-align:center"
                                         var="prepaid"
                                         value="#{loanWholeProcessCheckedStatListBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         reflow="true"
                                         selection="#{loanWholeProcessCheckedStatListBean.selectedRecords}"
                                         resizableColumns="true">
                                <p:column headerText="时间">
                                    <h:outputText value="#{prepaid.time}"/>
                                </p:column>
                                <p:column headerText="活动名称">
                                    <h:outputText value="#{loanWholeProcessCheckedStatListBean.OwnnerNameById(prepaid.activityname)}"/>
                                </p:column>
                                <p:column headerText="产品">
                                    <h:outputText value="#{loanWholeProcessCheckedStatListBean.transLateProduct(prepaid.productid)}"/>
                                </p:column>
                                <p:column headerText="渠道">
                                    <h:outputText value="#{loanWholeProcessCheckedStatListBean.transLateChannel(prepaid.channel)}"/>
                                </p:column>
                                <p:column headerText="来源">
                                    <h:outputText value="#{prepaid.c_from}"/>
                                </p:column>
                                <p:column headerText="UV数">
                                    <h:outputText value="#{prepaid.uv}"/>
                                </p:column>
                                <p:column headerText="进件数">
                                    <h:outputText value="#{prepaid.innernum}"/>
                                </p:column>
                                <p:column headerText="放款数">
                                    <h:outputText value="#{prepaid.outnum}"/>
                                </p:column>
                                <p:column headerText="放款总额">
                                    <h:outputText value="#{prepaid.outamount}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
